<template>
  <view>
    <div>
      <div >
        <h1 class="nice-title">修改名字</h1>
        <button class="save-button">保存</button>
      </div>
    </div>
    <div>
      <input type="text" id="name-input" v-model="name" class='name-input-container' />
    </div>
  </view>
</template>

<script>
export default {
  data() {
    return {
		name:'',
		};
  },
  created() {
      // 在组件创建时获取路由参数
      this.name = this.$route.query.name; // 如果没有参数，使用默认值
    },
  methods: {
    saveName() {
      console.log("新名字: " + this.name);
      // 这里可以添加代码将新名字发送到服务器或进行其他处理
    }
  }
};
</script>

<style>

.nice-title {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  
  text-align: center;
}

.name-input-container {
  border: 1px solid #ccc;
  padding: 10px;
  width: 200px;
}

.title-and-button-container {
  display: flex;
  justify-content: space-between;
  align-items: right;
  width: 100%;
}

.save-button {
  background-color: green;
  color: white;
  border: none;
  padding: 0px 6px;
  cursor: pointer;
  position: absolute;
  width:60px;
  height:45px;
  right: 0;
  top: 0;
  
}
#name-input {
  width: 100%;
  padding: 10px;
  margin-top: 20px;
}
</style>
